<!DOCTYPE html >
<html>
<head>
    <link rel="stylesheet" href="demos.css" type="text/css" media="screen" />
    
    <script src="../libraries/RGraph.svg.common.core.js" ></script>
    <script src="../libraries/RGraph.svg.hbar.js" ></script>
    
    <title>RGraph demo: A page showing the various Y scale variations of the SVG HBar chart</title>

    <meta name="robots" content="noindex,nofollow" />
    <meta name="description" content="A page showing the various Y scale variations of the SVG HBar chart" />
    
</head>
<body>



    <h1>A page showing the various Y scale variations of the SVG HBar chart</h1>



    <div id="chart-container1" style="width: 400px; height: 450px"></div><br />
    <div id="chart-container2" style="width: 400px; height: 450px"></div><br />
    <div id="chart-container3" style="width: 500px; height: 550px"></div><br />
    <div id="chart-container4" style="width: 500px; height: 450px"></div><br />
    <div id="chart-container5" style="width: 500px; height: 450px"></div><br />
    <div id="chart-container6" style="width: 500px; height: 450px"></div>

        <div id="fb-root"></div>
    <script>
        function loadFB (d)
        {
            var js, fjs = document.getElementsByTagName('script')[0];
            if (document.getElementById('facebook-jssdk')) {
                return;
            }
            
            js     = document.createElement('script');
            js.id  = 'facebook-jssdk';
            js.src = "//connect.facebook.net/en_GB/sdk.js#xfbml=1&version=v2.8";
            
            fjs.parentNode.insertBefore(js, fjs);
        }
        
        
        setTimeout(loadFB, 1500);
    </script>
    
    <style>
        div#sharePopup {
            display: inline-block;
            color: white;
            z-index: 2;
            min-width: 575px;
            height: 40px;
            margin-left: 0px;
            margin-top: 20px;
            margin-bottom: 20px;
            box-shadow: 1px -1px 2px #aaa;
            background-color: rgba(0,0,0,0.75);
            text-align: center;
            font-weight: bold;
            border-radius: 10px;
        }
    
        div#sharePopup span#label {
            position: relative;
            top: 5px;
        }
        
        div#sharePopup div.fb-like {
            text-align: center;
            display: inline-block;
            position: relative;
            top: 4px;
        }
    </style>
    
    <div id="sharePopup">
        <span id="label">If you like RGraph please share it:</span>
        <span style="display: inline-block; min-width: 225px">
            <div class="fb-like" data-href="https://www.rgraph.net" data-layout="button_count" data-action="like" data-show-faces="false" data-share="true"></div>
            <a href="javascript: null" onclick="window.open('http://www.twitter.com/share?url=https://www.rgraph.net&text=HTML5%20charts%20for%20the%20web%20with%20@_RGraph%20', 'twitter-sharer-window', 'top=50,left=50,width=700,height=300')"><img src="/images/twitter-60x20.png"  style="transform: translate(10px, 8px); box-shadow: 1px 1px 1px gray" border="0" /></a>
        </span>
    </div>

    <script>
        new RGraph.SVG.HBar({
            id: 'chart-container1',
            data: [-5,-7,-9,-11,-13,-15],
            options: {
                gutterLeftAutosize: false,
                gutterLeft: 15,
                gutterRight: 50,
                xaxisMax: -5,
                xaxisMin: -15,
                yaxisLabels: ['Harry','Lucy','Pete','Nick','Al','John'],
                title: 'Both min and max negative',
            }
        }).draw();
        
        new RGraph.SVG.HBar({
            id: 'chart-container2',
            data: [0,1,2,3,4,5,6],
            options: {
                xaxisMax: 10,
                yaxisLabels: ['Harry','Lucy','Pete','Nick','Al','John','Kevin'],
                title: 'Min set to zero and max positive',
                vmargin: 10,
                backgroundGridHlines: false,
                backgroundGridBorder: false,
                xaxis: false,
                yaxis: false
            }
        }).draw();


        new RGraph.SVG.HBar({
            id: 'chart-container3',
            data: [10,9,8,7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10],
            options: {
                xaxisMin: 'mirror',
                yaxisLabels: [
                    'Harry','Lucy','Pete','Nick','Al','John','Kerridge',
                    'Harry','Lucy','Pete','Nick','Al','John','Kerridge',
                    'Harry','Lucy','Pete','Nick','Al','John','Kerridge'
                ],
                title: 'Min negative and max positive',
                backgroundGridHlines: false,
                backgroundGridBorder: false,
                colors: [
                    'red', 'blue','green',
                    'red', 'blue','green',
                    'red', 'blue','green',
                    'red', 'blue','green',
                    'red', 'blue','green',
                    'red', 'blue','green',
                    'red', 'blue','green'
                ],
                colorsSequential: true,
            }
        }).draw();

        new RGraph.SVG.HBar({
            id: 'chart-container4',
            data: [5,6,7,8,9,10],
            options: {
                gutterRight: 190,
                title: 'Both min and max above zero',
                yaxisLabels: ['Ken','Larry','Kevin','Jobe','Lucy','John'],
                xaxisMin: 5,
                xaxisMax: 10,
                backgroundGridBorder: false,
                backgroundGridHlines: false
            }
        }).draw();


        new RGraph.SVG.HBar({
            id: 'chart-container5',
            data: [-1,-2,-3,-4,-5,-6,-7,-8,-9,-10],
            options: {
                gutterLeftAutosize: false,
                gutterLeft: 15,
                gutterRight: 50,
                title: 'Zero max and negative min',
                yaxisLabels: ['Ken','Larry','Kevin','Jobe','Lucy','John'],
                xaxisMin: -10,
                xaxisMax: 0,
                backgroundGridBorder: false,
                backgroundGridHlines: false
            }
        }).draw();


        new RGraph.SVG.HBar({
            id: 'chart-container6',
            data: [-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],
            options: {
                colors: ['Gradient(red:white:red:red:#c00:#600)'],
                vmargin: 1,
                title: 'Offset axis, negative min positive max',
                xaxisMin: -5,
                xaxisMax: 20,
                backgroundGridBorder: false,
                backgroundGridHlines: false
            }
        }).draw();
    </script>







    <p></p>

    This goes in the documents header:
    <pre class="code">
&lt;script src="RGraph.svg.common.core.js"&gt;&lt;/script&gt;
&lt;script src="RGraph.svg.hbar.js"&gt;&lt;/script&gt;
</pre>
    
    Put this where you want the chart to show up:
    <pre class="code">
&lt;div style="width: 400px; height: 450px" id="chart-container1"&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div style="width: 400px; height: 450px" id="chart-container2"&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div style="width: 500px; height: 550px" id="chart-container3"&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div style="width: 500px; height: 450px" id="chart-container4"&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div style="width: 500px; height: 450px" id="chart-container5"&gt;&lt;/div&gt;&lt;/div&gt;
&lt;div style="width: 500px; height: 450px" id="chart-container6"&gt;&lt;/div&gt;&lt;/div&gt;
</pre>

    This is the code that generates the chart:
    <pre class="code">
&lt;script&gt;
    new RGraph.SVG.HBar({
        id: 'chart-container1',
        data: [-5,-7,-9,-11,-13,-15],
        options: {
            gutterLeftAutosize: false,
            gutterLeft: 15,
            gutterRight: 50,
            xaxisMax: -5,
            xaxisMin: -15,
            yaxisLabels: ['Harry','Lucy','Pete','Nick','Al','John'],
            title: 'Both min and max negative',
        }
    }).draw();
    
    new RGraph.SVG.HBar({
        id: 'chart-container2',
        data: [0,1,2,3,4,5,6],
        options: {
            xaxisMax: 10,
            yaxisLabels: ['Harry','Lucy','Pete','Nick','Al','John','Kevin'],
            title: 'Min set to zero and max positive',
            vmargin: 10,
            backgroundGridHlines: false,
            backgroundGridBorder: false,
            xaxis: false,
            yaxis: false
        }
    }).draw();


    new RGraph.SVG.HBar({
        id: 'chart-container3',
        data: [10,9,8,7,6,5,4,3,2,1,0,-1,-2,-3,-4,-5,-6,-7,-8,-9,-10],
        options: {
            xaxisMin: 'mirror',
            yaxisLabels: [
                'Harry','Lucy','Pete','Nick','Al','John','Kerridge',
                'Harry','Lucy','Pete','Nick','Al','John','Kerridge',
                'Harry','Lucy','Pete','Nick','Al','John','Kerridge'
            ],
            title: 'Min negative and max positive',
            backgroundGridHlines: false,
            backgroundGridBorder: false,
            colors: [
                'red', 'blue','green',
                'red', 'blue','green',
                'red', 'blue','green',
                'red', 'blue','green',
                'red', 'blue','green',
                'red', 'blue','green',
                'red', 'blue','green'
            ],
            colorsSequential: true,
        }
    }).draw();

    new RGraph.SVG.HBar({
        id: 'chart-container4',
        data: [5,6,7,8,9,10],
        options: {
            gutterRight: 190,
            title: 'Both min and max above zero',
            yaxisLabels: ['Ken','Larry','Kevin','Jobe','Lucy','John'],
            xaxisMin: 5,
            xaxisMax: 10,
            backgroundGridBorder: false,
            backgroundGridHlines: false
        }
    }).draw();


    new RGraph.SVG.HBar({
        id: 'chart-container5',
        data: [-1,-2,-3,-4,-5,-6,-7,-8,-9,-10],
        options: {
            gutterLeftAutosize: false,
            gutterLeft: 15,
            gutterRight: 50,
            title: 'Zero max and negative min',
            yaxisLabels: ['Ken','Larry','Kevin','Jobe','Lucy','John'],
            xaxisMin: -10,
            xaxisMax: 0,
            backgroundGridBorder: false,
            backgroundGridHlines: false
        }
    }).draw();


    new RGraph.SVG.HBar({
        id: 'chart-container6',
        data: [-5,-4,-3,-2,-1,0,1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20],
        options: {
            colors: ['Gradient(red:white:red:red:#c00:#600)'],
            vmargin: 1,
            title: 'Offset axis, negative min positive max',
            xaxisMin: -5,
            xaxisMax: 20,
            backgroundGridBorder: false,
            backgroundGridHlines: false
        }
    }).draw();
&lt;/script&gt;
</pre>



    

    <p>
        <a href="./#svg">&laquo; Back</a>
    </p>

</body>
</html>